#ifndef SCOPE_ARRAY_H
#define SCOPE_ARRAY_H

#include <boost/scoped_array.hpp>

template<typename T>
class scoped_array : private boost::scoped_array<T>
{
	size_t size_;
public:
	scoped_array( T * p = 0, size_t size = 0) : boost::scoped_array<T>(p), size_(size){}
	
	inline size_t size() const {return size_;}
	inline void reset(T * p = 0, size_t size = 0) {boost::scoped_array<T>::reset(p);size_ = size;}
	
	inline T & operator[](std::ptrdiff_t i)  
	{
		return boost::scoped_array<T>::operator [](i);
	}

	inline T * get() const
	{
		return boost::scoped_array<T>::get();
	}

	inline T * get()
	{
		return boost::scoped_array<T>::get();
	}

	inline void swap(scoped_array<T>& rhs)
	{
		boost::scoped_array<T>::swap(rhs);
		auto tmp = rhs.size_;
		rhs.size_ = size_;
		size_ = tmp;
	}
};

#endif